/*
 * @Author: wuzhouhai wzh200x@126.com
 * @Date: 2024-07-02 11:40:33
 * @LastEditors: wuzhouhai wzh200x@126.com
 * @LastEditTime: 2024-07-12 15:33:24
 * @FilePath: \dwys_web\extensions\phoenix-plugin-client\assets\core\net\message\gameMessage\c2s\c2sMessage_login.ts
 * @Description: 
 */
import { Opcode } from "../../../../defines/opcode.define";
import proto from "../../../../protoc/ts/proto.js";
import { BaseMessage } from "../../message";

export class C2S_MessageLogin extends BaseMessage{
    constructor() {
        super(Opcode.Opcode_CS_LOGIN);
        this.messageEntity = proto.c2s_login.create();
    }

    public SetData(credential:string, iv : string){
        let message = this.GetMessageEntity<proto.c2s_login>();
        message.credential = credential;
        message.iv = iv;
    }

    Encode(): Uint8Array {
        if (!this.messageEntity) {
            return new Uint8Array();
        }
        return proto.c2s_login.encode(this.messageEntity).finish();
    }
}